package com.oms.view;

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTable;

import com.oms.context.OMSContext;
import javax.swing.JScrollPane;
import javax.swing.table.TableModel;

public class OMSApplicationView {

	private JFrame frmOmsNicks;
	private JTable table;

	/**
	 * Create the application.
	 */
	public OMSApplicationView(OMSContext context) {
		initialize(context);
		this.frmOmsNicks.setVisible(true);
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize(OMSContext context) {
		frmOmsNicks = new JFrame();
		frmOmsNicks.setTitle("OMS - Nick's Tactical");
		frmOmsNicks.setBounds(100, 100, 900, 600);
		frmOmsNicks.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frmOmsNicks.getContentPane().setLayout(new BorderLayout(0, 0));
		
		JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
		
		JPanel panel_home = new JPanel();
		tabbedPane.addTab("Home", null, panel_home, null);
		panel_home.setLayout(new BorderLayout(0, 0));
		
		table = new JTable(context.orderTableModel);
		table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
		
		JScrollPane scrollPane = new JScrollPane(table);
		
		panel_home.add(scrollPane);
		
		JPanel panel_order = new JPanel();
		tabbedPane.addTab("Order", null, panel_order, null);
		panel_order.setLayout(new BorderLayout(0, 0));
		frmOmsNicks.getContentPane().add(tabbedPane);
		
		JMenuBar menuBar = new JMenuBar();
		frmOmsNicks.setJMenuBar(menuBar);
		
		JMenu mnFile = new JMenu("File");
		menuBar.add(mnFile);
		
		JMenuItem mntmExit = new JMenuItem("Exit");
		mnFile.add(mntmExit);
		
		JMenu mnOptions = new JMenu("Options");
		menuBar.add(mnOptions);
		
		JMenuItem mntmSettings = new JMenuItem("Settings");
		mnOptions.add(mntmSettings);
	}

}
